<?php

namespace App\Http\Controllers\Dog;

use App\Exceptions\ApiException;
use App\Http\Controllers\Controller;
use App\Models\Common\CommonParam;
use App\Models\Config;
use App\Models\Dog\DogMerchant;
use App\Models\Dog\DogOwner;
use App\Models\Hourse\Hourse;
use App\Models\House\House;
use App\Models\House\HouseAttributeValue;
use App\Models\House\HouseFllowupRecord;
use App\Models\House\HouseImg;
use App\Models\House\Landlord;
use App\Models\User\SystemUser;
use App\Service\UserService;
use EasyWeChat\Factory;
use function foo\func;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Intervention\Image\Facades\Image;
use SimpleSoftwareIO\QrCode\Facades\QrCode;

/**
 * @group Dog 注册 
 */
class RegController extends Controller
{

    public function userReg(Request $request)
    {
       $request->validate([
            'name' => 'required',
            'phone' => 'required|unique:dog_owners',
            'password' => 'required',
            'dog_type' => 'string',
            'city' => 'required'
        ]);
       $data =$request->all();
        $data['password'] = bcrypt( $data['password']);
        DogOwner::query()->create($data);
        return returnData([],'操作成功');
    }

    public function merReg(Request $request)
    {
         $request->validate([
            'store_name' => 'required',
            'phone' => 'required|unique:dog_merchants',
            'password' => 'required',
            'city' => 'required'
        ]);
        $data =$request->all();
        $data['password'] = bcrypt( $data['password']);
        DogMerchant::query()->create($data);
        return returnData([],'操作成功');
    }
}
